package main

type Weekday int

/*
*

	接口 Stringer
*/
type Stringer interface {
	String() string
}

// Values 返回枚举的所有值
func Values() []string {
	return weekdayStr
}

const (
	Sunday Weekday = iota + 1
	Monday
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
)

var weekdayStr = []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}

func (w Weekday) String() string {
	return weekdayStr[w-1]
}
func (w Weekday) Index() int {
	return int(w)
}

// ExistOf 判断某值是否存在枚举值中
func ExistOf(str string) bool {
	for _, v := range weekdayStr {
		if v == str {
			return true
		}
	}
	return false
}
